package com.goldwind.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
@Configuration
public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "9021000150654740";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCHZWgwixck0x1Toeh36VVx/EueDCsixyFBCNsJaldXDuZGI/eZtdZV1uPQVmuXViN1Gi9TaSkNtfDfY1mFXfPHuhVFx7mjCgIYGYfEebzQlZH88iN6AYMtyWeBDtTWpoGwKYKx96JpwoCh9XE0vRAenJNLS0urpIsic4BjjL3Ow0CEe4TTcFya3Uc7jkEQCDORX23rOfaDgqtxr8JmQwR2PSsFQvno+311c8rHqbyqyx+ybBP8PlNiKOWZnRoyLklU0hHSx2sEi0U4zdmp7r8km0mDvYtolGvR3vWRJ/cnhX5JUI9X99XgMqe7ee+EUDc2nabU6prOkqiTn3Z6y7/rAgMBAAECggEAf6P66CCH7gBUWl59gGXpVm7pfpKsK7ocQGovzB2DPyBdt+v6ZN8Gs5/E3shJ376l6KSJzxGJUVKfRIktgMxEoJptqX4TJH+v37ZZxsCZXu5SVWqURVWdrBF90S4BOmZ4RnGrs0jnxNpHV+fCFFzUEHe9aDMQoDybqhvHApJQ8dS9qvoOC/iOmp9yR36z8gJirh8jJUtUSCNecLUsTVatNlTWWtLh2x9z7Z8l8wtofZOgoYIJMlRTwK2711KLn9AoetVywS/accZwGMTiYmI1240SQk176EOw9HjLHe1Iv6wB898AcXojtINh92allFJfQ2BlevSSmzFJdLG3+w7HAQKBgQDeaQBbWBHUUklspBDI8JleAYULMlWCOpOOiuwLG/ec+sZIMivTV2EToGbjgdtWp4D3K71YMKJoHpO+m8qFmQPuhlXC/CcjRa2t7ecEOUdSKUY458dXkfpVGTsNiBhVCxaAiErGHO8kHdy9igTnX61Y4UWEw+p1AXtBvE4dkQ84awKBgQCb2DMUvUDLxL0FMiGMF3e7T38XDA0ZlLuwca+4IAW1K1yDhDJRJt9rbEwhojFyjR6mfB8/kya28pye9pHd8QeuLs1mDU5JDnSA0TO3Zfgx01S1li68ayQYt78NaUbDqmReZwZ0vOCjWF9kqy7xqiDv76exlJYqiLYK5Fk0bh12gQKBgQCizBMRyZZLZuwN1M3gd5SbZdtfxbkneP73MKL0wsTtp/YpdGf165jIR/nn/+5wMG3K/r465maKdg9JTznfrpBdMQFnlzCCtgcaL/CQe+jDsCiRkL6uT9EAJ1a9YegFn/cZoCmzeAxn0F/6cSODxNnbHBHJy6o7eRkildZL+Bk+/wKBgQCF6Z7rATw+XA13+32sHTY687JnIWnYQ1+L3AR8GLgO1vWl5OA/r0Fn0yUP+Yi3v99Ie3t2a4Fmzs4aIhFxPn21BG5mdKSCTjN5xUnFG4/LcKZnamc6bG4V9z3pzj6KP04DeE+p2+rDMVq27AloiyHGSo40H1NxtQuIDHNChCQ5AQKBgQCFo9Jx9rdC0F0xIBNOF4enth6Cf7IX7FyqdTAvxgpNVR/gqVK4PgdbLbFf7KSBU5wIpPloj2FCn8VOOVMeJA9p3RWIJ/NqUwSyH+bAt1Jcohxp6xcTNhvxUN+VTb4Dg6TmGMGY3Hac/WYWlJ6mtWkw3f2Dotubo71Y7VEqKrXeDw==";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh2VoMIsXJNMdU6Hod+lVcfxLngwrIschQQjbCWpXVw7mRiP3mbXWVdbj0FZrl1YjdRovU2kpDbXw32NZhV3zx7oVRce5owoCGBmHxHm80JWR/PIjegGDLclngQ7U1qaBsCmCsfeiacKAofVxNL0QHpyTS0tLq6SLInOAY4y9zsNAhHuE03Bcmt1HO45BEAgzkV9t6zn2g4Krca/CZkMEdj0rBUL56Pt9dXPKx6m8qssfsmwT/D5TYijlmZ0aMi5JVNIR0sdrBItFOM3Zqe6/JJtJg72LaJRr0d71kSf3J4V+SVCPV/fV4DKnu3nvhFA3Np2m1OqazpKok592esu/6wIDAQAB";

    // 服务器"异步通知"页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080//AVR/notify_url.jsp";

    // 页面跳转"同步通知"页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/AVR/admin/addfunds";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "UTF-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";

    //日志文件存储路径
    public static String log_path = "C:\\aliPay";

    public static String format = "json";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
//    public static void logResult(String sWord) {
//        FileWriter writer = null;
//        try {
//            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
//            writer.write(sWord);
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            if (writer != null) {
//                try {
//                    writer.close();
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }
}
